<?php
header('Content-Type:text/html;charset=utf-8');
date_default_timezone_set('prc');

    $username=isset($_POST["username"]) ? trim($_POST["username"])  : "";
    $password=isset($_POST["password"]) ? trim($_POST["password"])  : "";
    $re=isset($_POST["re"]) ? trim($_POST["re"])  :"";
    $time=  date('y-m-d h:i:s',time());
    
    if (($username==="123")   && ($password==="456"))
    {
        //成功登录,并且你勾选了记住用户名，将这个用户名填到cookies里
        if ($re)
        {
            setcookie("cname",$username,time()+3600*24);
        }
        setcookie("time","$time",time()+3600*24);
        echo "<script language='javascript' type='text/javascript'>";
        echo "alert('登录成功！');";
        echo "window.location.href='login.php'";
        echo "</script>"; 
    }
    else
     {
        echo "<script language='javascript' type='text/javascript'>";
        echo "alert('登录失败！');";
        echo "window.location.href='login.php'";
        echo "</script>"; 
    }
    


